package com.song.demo.webmvc.aop;

import java.lang.reflect.Method;

/**
 * 异常通知实现类
 */
public class GPAfterThrowingAdvice  extends GPAbstractAspectJAdvice implements GPAdvice,GPMethodInterceptor  {

    private  String throwName;

    private GPMethodInvocation methodInvocation;


    public GPAfterThrowingAdvice(Method method, Object newInstance) {
        super(method,newInstance);
    }

    public void setThrowName(String throwName) {
        this.throwName = throwName;
    }

    @Override
    public Object invoke(GPMethodInvocation mi) throws Throwable {
       try{
            return mi.proceed();
       }catch (Exception e){
            invokeAdviceMethod(mi,null,e.getCause());
            throw e;
       }
    }



}
